package com.xps.charminguser.date.net;


import com.xps.charminguser.bean.LoginBean;
import com.xps.charminguser.bean.SeeOrderBean;
import com.xps.charminguser.bean.VerificationBean;
import com.xps.charminguser.bean.WaitOrderBean;
import com.xps.charminguser.date.servicrapi.UserApi;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

public class UserNetWorks extends RetrofitUtils {

    protected static final UserApi userApi = RetrofitUtils.getUserApi();


    /**
     * @deprecated 登陆
     * username 用户名
     * password 密码
     */
    public static void UserLogin(String username, String password, Subscriber<LoginBean> observer) {
        userApi.goLogin(username, password).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //注册验证码接口
    public static void getVerification(String rider_tel, Subscriber<VerificationBean> observer) {
        userApi.getVerification(rider_tel).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //骑手注册接口
    public static void getRegisterRider(String rider_register_way, String rider_email, String rider_name, String rider_sex, String rider_password, String rider_tel, String sms_code, String rider_avatar, Subscriber<VerificationBean> observer) {
        userApi.getRegisterRider(rider_register_way, rider_email, rider_name, rider_sex, rider_password, rider_tel, sms_code, rider_avatar).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //获取等待接单列表
    public static void getWaitOrder(String rider_token, Subscriber<WaitOrderBean> observer) {
        userApi.getWaitOrder(rider_token).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    public static void getAcceptOrder(String rider_token, String order_id, Subscriber<VerificationBean> observer) {
        userApi.getAcceptOrder(rider_token, order_id).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    public static void getOrder(String rider_token, Subscriber<WaitOrderBean> observer) {
        userApi.getOrder(rider_token).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    public static void getSeeOrder(String rider_token, String order_id, Subscriber<SeeOrderBean> observer) {
        userApi.getSeeOrder(rider_token, order_id).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }  //获取等待接单列表

    public static void getCompleteOrder(String rider_token, String order_id, String order_payment_method, Subscriber<VerificationBean> observer) {
        userApi.getCompleteOrder(rider_token, order_id, order_payment_method).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }
}
